// // Copyright (c) 2009 All Right Reserved // // vl // // 2009-01-01 // Contains ... using System.Diagnostics.Contracts; namespace LargoCommon.Music { /// /// StructuralVariety Factory. /// public static class StructuralVarietyFactory { #region Factory of structures /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewHarmonicStructuralVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewRhythmicStructuralVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewRhythmicShapeVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewMelStructuralVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewHarmonicModalityVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// /// Initializes a new instance of the StructuralVariety class. /// /// Type of variety. /// The given system. /// Abstract qualifier. /// Limit for number od structures. /// /// Returns value. /// [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewRhythmicModalityVariety( StructuralVarietyType varietyType, GeneralSystem givenSystem, GeneralQualifier qualifier, int limitCount) { //// Contract.Requires(givenSystem != null); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } #endregion #region Factory of substructures /// Initializes a new instance of the StructuralVariety class. /// Type of variety. /// Abstract modality. /// Abstract qualifier. /// Limit for number od structures. /// Returns value. [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewHarmonicStructModalVariety( //// Type T StructuralVarietyType varietyType, BinaryStructure modality, GeneralQualifier qualifier, int limitCount) { Contract.Requires(modality != null); //// if (modality == null) { return null; } var givenSystem = modality.GSystem; var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Modality = modality, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// Initializes a new instance of the StructuralVariety class. /// Type of variety. /// Abstract modality. /// Abstract qualifier. /// Limit for number od structures. /// Returns value. [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewRhythmicStructModalVariety( //// Type T StructuralVarietyType varietyType, BinaryStructure modality, GeneralQualifier qualifier, int limitCount) { Contract.Requires(modality != null); if (modality == null) { return null; } var givenSystem = new GeneralSystem(3, modality.GSystem.Order); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Modality = modality, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } /// Initializes a new instance of the StructuralVariety class. /// Type of variety. /// Abstract modality. /// Abstract qualifier. /// Limit for number od structures. /// Returns value. [JetBrains.Annotations.PureAttribute] public static StructuralVariety NewRhythmicShapeModalVariety( //// Type T StructuralVarietyType varietyType, BinaryStructure modality, GeneralQualifier qualifier, int limitCount) { Contract.Requires(modality != null); //// if (modality == null) { return null; } var givenSystem = new GeneralSystem(2, modality.GSystem.Order); var gsv = new StructuralVariety(givenSystem) { VarType = varietyType, Modality = modality, Qualifier = qualifier, LimitCount = limitCount }; gsv.Generate(); return gsv; } #endregion } }